<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>GitHub Issue 1422</title>
    <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
    <script src="../../../dist/jsoneditor.js"></script>
  </head>
  <body>
    <div class="container">
      <textarea class="form-control" id="value" cols="30" rows="10"></textarea>
      <a href="https://github.com/json-editor/json-editor/issues/1422">GitHub Issue 1422</a>
      <div id='editor_holder'></div>
    </div>

    <script>
      var value = document.querySelector('#value')
      var defaultSchema = {
        "type": "object",
        "required": [
          "req",
          "req_with_default"
        ],
        "properties": {
          "req": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "opt": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "req_with_default": {
            "type": "integer",
            "default": 5,
            "minimum": 1,
            "maximum": 10
          },
          "opt_with_default": {
            "type": "integer",
            "default": 5,
            "minimum": 1,
            "maximum": 10
          }
        }
      }

      var editor = new JSONEditor(document.getElementById('editor_holder'),{
        iconlib: 'fontawesome5',
        schema: defaultSchema,
        show_errors: 'always',
        theme: 'bootstrap4',
        use_default_values: false,
        startval: {
          "req": 5,
          "opt": 5
        }
      });

      editor.on('change', function () {
        value.value = JSON.stringify(editor.getValue())
      })
    </script>
  </body>
</html>
